<template>
    <div class="page">
        <div id="mapContent"></div>
    </div>
</template>
<script>
let heatmap;
let map;
export default {
    name: 'mapHeat',
    data() {
        return {
            mapCenter: [126.63297, 45.76175],
            drewOverlayGroup: null,
            polygonMarker: null
        }
    },
    mounted() {
        let query = this.$route.query;
        let schoolId = query.schoolId;
        this.loadAMap();
    },
    methods: {
        loadAMap() {
            const script = document.createElement('script');
            script.type = 'text/javascript';
            script.src = 'https://webapi.amap.com/maps?v=2.0&key=0eb3ce55e7f4b0ddfe8ffd466e43d8a5'; // 替换为你的API密钥
            document.head.appendChild(script);
            script.onload = () => {
                this.initMap();
            };
        },
        // 创建地图
        initMap() {
            map = new AMap.Map('mapContent', {
                zoom: 14,
                center: this.mapCenter
            });
            this.drewOverlayGroup = new AMap.OverlayGroup([]);
            map.add(this.drewOverlayGroup);
            this.addPolygon([
                { path: [[126.62297, 45.74175], [126.63197, 45.75475], [126.63297, 45.76375], [126.61197, 45.76475]], num: 205 },
                { path: [[126.59197, 45.70475], [126.60297, 45.71175], [126.61297, 45.7575], [126.60197, 45.76475]], num: 95 }
            ]);
            this.addHeatMap();
        },
        // 添加热力图
        addHeatMap() {
            if (!this.isSupportCanvas()) {
                alert('热力图仅对支持canvas的浏览器适用,您所使用的浏览器不能使用热力图功能,请换个浏览器试试~')
            }
            map.plugin(["AMap.HeatMap"], function () {
                //初始化heatmap对象
                heatmap = new AMap.HeatMap(map, {
                    radius: 25, //给定半径
                    opacity: [0, 0.8]
                    /*,
                    gradient:{
                        0.5: 'blue',
                        0.65: 'rgb(117,211,248)',
                        0.7: 'rgb(0, 255, 0)',
                        0.9: '#ffea00',
                        1.0: 'red'
                    }
                     */
                });
                heatmap.setDataSet({
                    data: [{ "lng": 126.691031, "lat": 45.788585, "count": 10 }, { "lng": 126.689275, "lat": 45.725818, "count": 11 }, { "lng": 126.687444, "lat": 45.810742, "count": 12 }, { "lng": 126.681707, "lat": 45.740089, "count": 13 }, { "lng": 126.610588, "lat": 45.880172, "count": 14 }, { "lng": 126.694816, "lat": 45.71181, "count": 15 }, { "lng": 126.616002, "lat": 45.752917, "count": 16 }, { "lng": 126.69671, "lat": 45.724903, "count": 17 }, { "lng": 126.680816, "lat": 45.757553, "count": 18 }, { "lng": 126.682035, "lat": 45.874114, "count": 19 }, { "lng": 126.616648, "lat": 45.714529, "count": 20 }, { "lng": 126.695803, "lat": 45.708556, "count": 21 }, { "lng": 126.64553, "lat": 45.875916, "count": 22 }, { "lng": 126.652289, "lat": 45.716475, "count": 23 }, { "lng": 126.641548, "lat": 45.878262, "count": 24 }, { "lng": 126.618947, "lat": 45.742735, "count": 25 }, { "lng": 126.682585, "lat": 45.741949, "count": 26 }, { "lng": 126.62042, "lat": 45.884017, "count": 27 }, { "lng": 126.61744, "lat": 45.892561, "count": 28 }, { "lng": 126.607059, "lat": 45.712438, "count": 29 }, { "lng": 126.612351, "lat": 45.888082, "count": 30 }, { "lng": 126.644341, "lat": 45.715891, "count": 31 }, { "lng": 126.635385, "lat": 45.741756, "count": 32 }, { "lng": 126.6926, "lat": 40.008733, "count": 33 }, { "lng": 126.689731, "lat": 45.72292, "count": 34 }, { "lng": 126.613371, "lat": 45.874483, "count": 35 }, { "lng": 126.699752, "lat": 45.711717, "count": 36 }, { "lng": 126.678472, "lat": 40.254994, "count": 37 }, { "lng": 126.664252, "lat": 45.725828, "count": 38 }, { "lng": 126.679475, "lat": 45.737945, "count": 45 }, { "lng": 126.615599, "lat": 45.756902, "count": 40 }, { "lng": 126.655675, "lat": 45.870089, "count": 41 }, { "lng": 126.695267, "lat": 45.787171, "count": 42 }, { "lng": 126.623634, "lat": 45.711692, "count": 43 }, { "lng": 126.692769, "lat": 40.173307, "count": 44 }, { "lng": 126.687888, "lat": 45.728531, "count": 45 }, { "lng": 126.686502, "lat": 45.722747, "count": 46 }, { "lng": 126.636773, "lat": 40.218341, "count": 47 }, { "lng": 126.690636, "lat": 45.804253, "count": 48 }, { "lng": 126.691095, "lat": 45.725791, "count": 49 }, { "lng": 126.672402, "lat": 45.769178, "count": 50 }, { "lng": 126.68657, "lat": 45.756731, "count": 51 }, { "lng": 126.627536, "lat": 45.743671, "count": 52 }, { "lng": 126.674547, "lat": 45.767588, "count": 53 }, { "lng": 126.680383, "lat": 45.871634, "count": 54 }, { "lng": 126.676092, "lat": 45.765485, "count": 55 }, { "lng": 126.652424, "lat": 45.71811, "count": 56 }, { "lng": 126.020157, "lat": 40.348526, "count": 57 }, { "lng": 126.616201, "lat": 45.751736, "count": 58 }, { "lng": 126.605392, "lat": 45.708738, "count": 59 }, { "lng": 126.69238, "lat": 45.726248, "count": 60 }, { "lng": 126.689282, "lat": 45.788391, "count": 61 }, { "lng": 126.696683, "lat": 45.723487, "count": 62 }, { "lng": 126.61718, "lat": 45.705213, "count": 63 }, { "lng": 126.621512, "lat": 45.713192, "count": 64 }, { "lng": 126.660028, "lat": 40.03353, "count": 65 }, { "lng": 126.694846, "lat": 45.711168, "count": 66 }, { "lng": 126.674767, "lat": 45.76608, "count": 67 }, { "lng": 126.6841, "lat": 45.709762, "count": 68 }, { "lng": 126.6838, "lat": 45.75811, "count": 69 }, { "lng": 126.69243, "lat": 40.01143, "count": 70 }, { "lng": 126.661912, "lat": 40.121137, "count": 71 }, { "lng": 126.633056, "lat": 45.70123, "count": 72 }, { "lng": 126.684839, "lat": 45.881729, "count": 73 }, { "lng": 126.660923, "lat": 45.735745, "count": 74 }, { "lng": 126.608531, "lat": 45.753194, "count": 75 }, { "lng": 126.617916, "lat": 45.754029, "count": 76 }, { "lng": 126.612215, "lat": 45.792282, "count": 77 }, { "lng": 126.681532, "lat": 40.048762, "count": 78 }, { "lng": 126.634848, "lat": 40.070463, "count": 79 }, { "lng": 126.685039, "lat": 45.756937, "count": 80 }, { "lng": 126.655067, "lat": 45.854499, "count": 81 }, { "lng": 126.696061, "lat": 45.712841, "count": 82 }, { "lng": 126.674303, "lat": 45.771398, "count": 83 }, { "lng": 126.676262, "lat": 45.85811, "count": 84 }, { "lng": 126.603783, "lat": 45.754469, "count": 85 }, { "lng": 126.639136, "lat": 45.729159, "count": 86 }, { "lng": 126.640159, "lat": 45.747003, "count": 87 }, { "lng": 117.107541, "lat": 40.141457, "count": 88 }, { "lng": 126.641813, "lat": 40.078786, "count": 89 }, { "lng": 126.620648, "lat": 45.706455, "count": 90 }, { "lng": 126.602566, "lat": 45.760873, "count": 91 }, { "lng": 126.649261, "lat": 40.402999, "count": 92 }, { "lng": 126.621064, "lat": 45.834187, "count": 93 }, { "lng": 126.629942, "lat": 45.725327, "count": 94 }, { "lng": 126.679852, "lat": 45.774856, "count": 95 }, { "lng": 126.699185, "lat": 45.725736, "count": 96 }, { "lng": 126.693166, "lat": 45.711953, "count": 1 }, { "lng": 126.600916, "lat": 45.870614, "count": 2 }, { "lng": 126.618041, "lat": 45.756615, "count": 3 }, { "lng": 126.688981, "lat": 45.797716, "count": 4 }, { "lng": 126.685852, "lat": 45.863497, "count": 5 }, { "lng": 126.694167, "lat": 45.884599, "count": 6 }, { "lng": 126.694235, "lat": 45.796845, "count": 7 }, { "lng": 126.62471, "lat": 45.770486, "count": 8 }, { "lng": 126.696828, "lat": 45.79335, "count": 9 }, { "lng": 126.682534, "lat": 45.734086, "count": 10 }, { "lng": 126.654662, "lat": 45.774981, "count": 11 }, { "lng": 126.687076, "lat": 45.87631, "count": 12 }, { "lng": 126.633341, "lat": 45.72803, "count": 13 }, { "lng": 126.682196, "lat": 45.741606, "count": 14 }, { "lng": 126.644286, "lat": 45.82905, "count": 15 }, { "lng": 126.666672, "lat": 40.176097, "count": 16 }, { "lng": 126.686862, "lat": 45.708507, "count": 17 }, { "lng": 117.240166, "lat": 40.175796, "count": 18 }, { "lng": 126.628661, "lat": 45.866958, "count": 19 }, { "lng": 126.643292, "lat": 45.717447, "count": 20 }, { "lng": 126.656538, "lat": 45.726711, "count": 21 }, { "lng": 126.694086, "lat": 45.712242, "count": 22 }, { "lng": 126.679861, "lat": 45.771831, "count": 23 }, { "lng": 126.677966, "lat": 45.874647, "count": 24 }, { "lng": 126.666778, "lat": 45.726304, "count": 25 }, { "lng": 126.692078, "lat": 40.170197, "count": 26 }, { "lng": 126.628651, "lat": 45.74275, "count": 27 }, { "lng": 126.622655, "lat": 45.739517, "count": 28 }, { "lng": 126.645601, "lat": 45.78439, "count": 29 }, { "lng": 126.662833, "lat": 45.712238, "count": 30 }, { "lng": 126.694183, "lat": 45.725557, "count": 31 }, { "lng": 126.612788, "lat": 45.860017, "count": 32 }, { "lng": 126.604708, "lat": 40.065563, "count": 33 }, { "lng": 126.604443, "lat": 45.738295, "count": 34 }, { "lng": 126.610917, "lat": 45.89381, "count": 35 }, { "lng": 126.665851, "lat": 45.834247, "count": 36 }, { "lng": 126.63501, "lat": 45.742507, "count": 37 }, { "lng": 126.697519, "lat": 45.79794, "count": 38 }, { "lng": 126.641252, "lat": 45.715566, "count": 45 }, { "lng": 126.641898, "lat": 45.856454, "count": 40 }, { "lng": 126.646552, "lat": 45.746418, "count": 41 }, { "lng": 126.659761, "lat": 45.895327, "count": 42 }, { "lng": 126.649168, "lat": 45.893551, "count": 43 }, { "lng": 126.676819, "lat": 45.74388, "count": 44 }, { "lng": 126.69912, "lat": 45.788433, "count": 45 }, { "lng": 126.667912, "lat": 45.770524, "count": 46 }, { "lng": 126.682134, "lat": 45.862204, "count": 47 }, { "lng": 126.683378, "lat": 45.73431, "count": 48 }, { "lng": 126.65395, "lat": 45.710738, "count": 49 }, { "lng": 126.698771, "lat": 45.776433, "count": 50 }, { "lng": 126.662189, "lat": 45.725864, "count": 51 }, { "lng": 126.678957, "lat": 45.806676, "count": 52 }, { "lng": 126.634199, "lat": 45.700985, "count": 53 }, { "lng": 126.643961, "lat": 45.713511, "count": 54 }, { "lng": 126.688829, "lat": 45.75053, "count": 55 }, { "lng": 126.619655, "lat": 45.892339, "count": 56 }, { "lng": 117.431959, "lat": 40.630521, "count": 57 }, { "lng": 117.108914, "lat": 40.140406, "count": 58 }, { "lng": 126.63019, "lat": 45.880486, "count": 59 }, { "lng": 126.650698, "lat": 45.707186, "count": 60 }, { "lng": 126.641065, "lat": 45.766082, "count": 61 }, { "lng": 126.690335, "lat": 45.812431, "count": 62 }, { "lng": 126.660813, "lat": 45.736362, "count": 63 }, { "lng": 126.600282, "lat": 45.795027, "count": 64 }, { "lng": 126.617257, "lat": 45.889092, "count": 65 }, { "lng": 126.682537, "lat": 45.754978, "count": 66 }, { "lng": 126.68496, "lat": 45.754428, "count": 67 }, { "lng": 126.691803, "lat": 45.711587, "count": 68 }, { "lng": 126.6266, "lat": 45.867228, "count": 69 }, { "lng": 126.645997, "lat": 45.790856, "count": 70 }, { "lng": 126.630265, "lat": 45.867451, "count": 71 }, { "lng": 126.615479, "lat": 45.740668, "count": 72 }, { "lng": 126.659393, "lat": 45.775431, "count": 73 }, { "lng": 126.682347, "lat": 45.768935, "count": 74 }, { "lng": 115.987169, "lat": 40.454625, "count": 75 }, { "lng": 126.689292, "lat": 45.731242, "count": 76 }, { "lng": 126.668238, "lat": 45.879807, "count": 77 }, { "lng": 126.693761, "lat": 45.723885, "count": 78 }, { "lng": 126.63666, "lat": 45.8778, "count": 79 }, { "lng": 126.601743, "lat": 45.79602, "count": 80 }, { "lng": 126.682818, "lat": 45.732646, "count": 81 }, { "lng": 126.617364, "lat": 45.869292, "count": 82 }, { "lng": 126.654305, "lat": 45.872022, "count": 83 }, { "lng": 126.675162, "lat": 40.01344, "count": 84 }, { "lng": 126.600523, "lat": 45.881031, "count": 85 }, { "lng": 126.615365, "lat": 45.745005, "count": 86 }, { "lng": 126.64088, "lat": 45.810753, "count": 87 }, { "lng": 126.679285, "lat": 45.716527, "count": 88 }, { "lng": 126.683694, "lat": 45.746929, "count": 89 }, { "lng": 126.641678, "lat": 40.080021, "count": 90 }, { "lng": 126.017167, "lat": 45.889175, "count": 91 }, { "lng": 126.654692, "lat": 45.754167, "count": 92 }, { "lng": 126.610129, "lat": 40.050952, "count": 93 }, { "lng": 126.618556, "lat": 45.872365, "count": 94 }, { "lng": 126.65432, "lat": 40.142367, "count": 95 }, { "lng": 126.658763, "lat": 45.891072, "count": 96 }, { "lng": 126.605312, "lat": 45.7953, "count": 97 }, { "lng": 126.688761, "lat": 45.751259, "count": 98 }, { "lng": 126.68017, "lat": 45.873413, "count": 99 }, { "lng": 126.090539, "lat": 45.796301, "count": 1 }, { "lng": 126.680305, "lat": 45.78354, "count": 2 }, { "lng": 126.648831, "lat": 40.022543, "count": 3 }, { "lng": 126.638133, "lat": 45.760988, "count": 4 }, { "lng": 126.699587, "lat": 45.711, "count": 5 }, { "lng": 126.081743, "lat": 45.788321, "count": 6 }, { "lng": 117.24044, "lat": 40.1752, "count": 7 }, { "lng": 126.636141, "lat": 40.327724, "count": 8 }, { "lng": 126.653166, "lat": 45.773511, "count": 9 }, { "lng": 126.683381, "lat": 45.753315, "count": 10 }, { "lng": 126.636326, "lat": 45.70595, "count": 11 }, { "lng": 126.628305, "lat": 45.781647, "count": 12 }, { "lng": 126.660012, "lat": 45.784951, "count": 13 }, { "lng": 126.654938, "lat": 45.716206, "count": 14 }, { "lng": 126.65469, "lat": 40.474419, "count": 15 }, { "lng": 126.609389, "lat": 45.771918, "count": 16 }, { "lng": 126.610732, "lat": 45.771517, "count": 17 }, { "lng": 126.601885, "lat": 45.847641, "count": 18 }, { "lng": 126.627771, "lat": 45.880572, "count": 19 }, { "lng": 126.630537, "lat": 45.880968, "count": 20 }, { "lng": 126.650673, "lat": 45.895212, "count": 21 }, { "lng": 126.645906, "lat": 45.815152, "count": 22 }, { "lng": 126.612016, "lat": 45.868573, "count": 23 }, { "lng": 115.894604, "lat": 45.803644, "count": 24 }, { "lng": 126.62497, "lat": 40.083198, "count": 25 }, { "lng": 126.615523, "lat": 45.858242, "count": 26 }, { "lng": 126.665052, "lat": 45.703055, "count": 27 }, { "lng": 126.664814, "lat": 45.724176, "count": 28 }, { "lng": 115.959538, "lat": 45.727218, "count": 29 }, { "lng": 126.678895, "lat": 45.754472, "count": 30 }, { "lng": 126.637546, "lat": 45.741337, "count": 31 }, { "lng": 126.604757, "lat": 45.83778, "count": 32 }, { "lng": 126.693143, "lat": 40.02725, "count": 33 }, { "lng": 126.63419, "lat": 40.217361, "count": 34 }, { "lng": 126.668688, "lat": 45.829561, "count": 35 }, { "lng": 126.660134, "lat": 45.783721, "count": 36 }, { "lng": 126.681539, "lat": 45.746766, "count": 37 }, { "lng": 126.691759, "lat": 45.783886, "count": 38 }, { "lng": 126.677613, "lat": 45.817895, "count": 45 }, { "lng": 126.606646, "lat": 45.756296, "count": 40 }, { "lng": 126.660747, "lat": 45.818863, "count": 41 }, { "lng": 126.692912, "lat": 40.001989, "count": 42 }, { "lng": 126.699115, "lat": 45.71276, "count": 43 }, { "lng": 126.634577, "lat": 45.812232, "count": 44 }, { "lng": 126.695843, "lat": 45.725538, "count": 45 }, { "lng": 126.633803, "lat": 45.713224, "count": 46 }, { "lng": 126.689277, "lat": 45.741842, "count": 47 }, { "lng": 126.610514, "lat": 45.773547, "count": 48 }, { "lng": 126.674685, "lat": 45.736648, "count": 49 }, { "lng": 126.618054, "lat": 45.705091, "count": 50 }, { "lng": 126.685529, "lat": 45.726274, "count": 51 }, { "lng": 126.689399, "lat": 45.748054, "count": 52 }, { "lng": 126.608241, "lat": 45.720234, "count": 53 }, { "lng": 126.617979, "lat": 40.000721, "count": 54 }, { "lng": 126.628324, "lat": 45.868263, "count": 55 }, { "lng": 126.607517, "lat": 40.016715, "count": 56 }, { "lng": 126.638841, "lat": 45.769646, "count": 57 }, { "lng": 126.695703, "lat": 45.792607, "count": 58 }, { "lng": 126.669659, "lat": 45.77595, "count": 59 }, { "lng": 126.691709, "lat": 45.76228, "count": 60 }, { "lng": 126.611003, "lat": 45.798264, "count": 61 }, { "lng": 126.691429, "lat": 45.73324, "count": 62 }, { "lng": 126.606033, "lat": 45.75407, "count": 63 }, { "lng": 126.691856, "lat": 45.712004, "count": 64 }, { "lng": 126.656434, "lat": 45.871474, "count": 65 }, { "lng": 126.677081, "lat": 45.770334, "count": 66 }, { "lng": 126.675337, "lat": 45.739749, "count": 67 }, { "lng": 126.652911, "lat": 45.716369, "count": 68 }, { "lng": 126.670361, "lat": 45.874606, "count": 69 }, { "lng": 126.689172, "lat": 45.749033, "count": 70 }, { "lng": 126.602514, "lat": 45.773734, "count": 71 }, { "lng": 126.686985, "lat": 45.720185, "count": 72 }, { "lng": 126.683743, "lat": 45.75335, "count": 73 }, { "lng": 126.619183, "lat": 45.732055, "count": 74 }, { "lng": 126.691902, "lat": 45.73331, "count": 75 }, { "lng": 126.688588, "lat": 45.753371, "count": 76 }, { "lng": 126.681798, "lat": 45.775717, "count": 77 }, { "lng": 126.684689, "lat": 45.827773, "count": 78 }, { "lng": 126.645287, "lat": 45.894354, "count": 79 }, { "lng": 126.64048, "lat": 45.747687, "count": 80 }, { "lng": 126.613605, "lat": 40.04902, "count": 81 }, { "lng": 126.639012, "lat": 45.704288, "count": 82 }, { "lng": 126.608522, "lat": 40.016971, "count": 83 }, { "lng": 126.675833, "lat": 45.747107, "count": 84 }, { "lng": 126.63476, "lat": 45.701671, "count": 85 }, { "lng": 126.60229, "lat": 45.869205, "count": 86 }, { "lng": 126.626013, "lat": 40.213485, "count": 87 }, { "lng": 126.689042, "lat": 45.889192, "count": 88 }, { "lng": 126.677252, "lat": 45.873622, "count": 89 }, { "lng": 126.63061, "lat": 40.103146, "count": 90 }, { "lng": 126.616271, "lat": 45.705187, "count": 91 }, { "lng": 126.631169, "lat": 45.71276, "count": 92 }, { "lng": 126.67849, "lat": 40.075692, "count": 93 }, { "lng": 126.688616, "lat": 40.102413, "count": 94 }, { "lng": 126.631799, "lat": 45.84939, "count": 95 }, { "lng": 126.643707, "lat": 45.87558, "count": 96 }, { "lng": 126.614298, "lat": 40.53416, "count": 97 }, { "lng": 126.628247, "lat": 45.873118, "count": 98 }, { "lng": 126.690774, "lat": 45.763116, "count": 99 }, { "lng": 126.699918, "lat": 45.736094, "count": 100 }, { "lng": 126.689325, "lat": 45.744556, "count": 101 }, { "lng": 126.639297, "lat": 40.038739, "count": 102 }, { "lng": 126.685631, "lat": 45.804667, "count": 103 }, { "lng": 126.680549, "lat": 45.755012, "count": 104 }, { "lng": 126.681977, "lat": 45.878496, "count": 1 }, { "lng": 126.659586, "lat": 40.043622, "count": 2 }, { "lng": 126.687813, "lat": 40.015618, "count": 3 }, { "lng": 126.65472, "lat": 45.775865, "count": 4 }, { "lng": 126.644011, "lat": 40.299776, "count": 5 }, { "lng": 126.699449, "lat": 45.75324, "count": 6 }, { "lng": 126.632228, "lat": 45.700741, "count": 7 }, { "lng": 126.677459, "lat": 45.80869, "count": 8 }, { "lng": 126.657873, "lat": 40.120521, "count": 9 }, { "lng": 126.654466, "lat": 45.731616, "count": 10 }, { "lng": 126.645418, "lat": 40.375612, "count": 11 }, { "lng": 126.666696, "lat": 45.766475, "count": 12 }, { "lng": 126.65685, "lat": 40.011172, "count": 13 }, { "lng": 126.606651, "lat": 45.770182, "count": 14 }, { "lng": 126.628161, "lat": 45.866144, "count": 15 }, { "lng": 126.604801, "lat": 45.836822, "count": 16 }, { "lng": 126.639995, "lat": 45.81546, "count": 17 }, { "lng": 126.659057, "lat": 45.736131, "count": 18 }, { "lng": 126.625584, "lat": 45.842961, "count": 19 }, { "lng": 126.64103, "lat": 40.141812, "count": 20 }, { "lng": 126.606028, "lat": 45.860581, "count": 21 }, { "lng": 126.603426, "lat": 40.066843, "count": 22 }, { "lng": 126.699935, "lat": 40.009504, "count": 23 }, { "lng": 126.609222, "lat": 45.713107, "count": 24 }, { "lng": 126.695396, "lat": 45.784501, "count": 25 }, { "lng": 126.689673, "lat": 45.763462, "count": 26 }, { "lng": 126.645731, "lat": 40.051509, "count": 27 }, { "lng": 126.695362, "lat": 45.775426, "count": 28 }, { "lng": 126.605608, "lat": 40.0489, "count": 29 }, { "lng": 126.621157, "lat": 45.775636, "count": 30 }, { "lng": 126.652161, "lat": 45.777081, "count": 31 }, { "lng": 126.642604, "lat": 40.22134, "count": 32 }, { "lng": 126.62532, "lat": 45.770535, "count": 33 }, { "lng": 126.685587, "lat": 45.726874, "count": 34 }, { "lng": 126.69186, "lat": 45.712056, "count": 35 }, { "lng": 126.626004, "lat": 45.774148, "count": 36 }, { "lng": 126.677542, "lat": 45.892667, "count": 37 }, { "lng": 126.635958, "lat": 40.375008, "count": 38 }, { "lng": 126.684969, "lat": 45.756518, "count": 45 }, { "lng": 115.95685, "lat": 45.732297, "count": 40 }, { "lng": 126.680024, "lat": 45.872133, "count": 41 }, { "lng": 126.696477, "lat": 45.728246, "count": 42 }, { "lng": 126.690986, "lat": 45.72675, "count": 43 }, { "lng": 126.646845, "lat": 40.018932, "count": 44 }, { "lng": 126.681966, "lat": 45.770729, "count": 45 }, { "lng": 126.637349, "lat": 45.752131, "count": 46 }, { "lng": 126.694995, "lat": 45.79648, "count": 47 }, { "lng": 126.614029, "lat": 45.516896, "count": 48 }, { "lng": 126.662237, "lat": 40.122764, "count": 49 }, { "lng": 126.641367, "lat": 40.379938, "count": 50 }, { "lng": 126.665928, "lat": 45.775824, "count": 51 }, { "lng": 126.689236, "lat": 45.739992, "count": 52 }, { "lng": 126.663994, "lat": 45.852943, "count": 53 }, { "lng": 126.64283, "lat": 45.754081, "count": 54 }, { "lng": 126.661183, "lat": 45.894634, "count": 55 }, { "lng": 126.612822, "lat": 45.7769, "count": 56 }, { "lng": 126.60433, "lat": 45.77541, "count": 57 }, { "lng": 126.613478, "lat": 45.748868, "count": 58 }, { "lng": 126.606129, "lat": 45.732386, "count": 59 }, { "lng": 126.651852, "lat": 45.795137, "count": 60 }, { "lng": 126.649718, "lat": 45.870509, "count": 61 }, { "lng": 126.668628, "lat": 45.726382, "count": 62 }, { "lng": 126.643881, "lat": 40.300758, "count": 63 }, { "lng": 126.640445, "lat": 45.881325, "count": 64 }, { "lng": 126.68299, "lat": 45.869588, "count": 65 }, { "lng": 126.623732, "lat": 40.082528, "count": 66 }, { "lng": 126.657834, "lat": 45.876782, "count": 67 }, { "lng": 126.6596, "lat": 40.034545, "count": 68 }, { "lng": 126.649841, "lat": 45.875597, "count": 69 }, { "lng": 126.603928, "lat": 45.879252, "count": 70 }, { "lng": 126.62005, "lat": 45.833467, "count": 71 }, { "lng": 126.663001, "lat": 45.71046, "count": 72 }, { "lng": 126.606568, "lat": 45.708939, "count": 73 }, { "lng": 126.605188, "lat": 45.709159, "count": 74 }, { "lng": 126.615107, "lat": 45.872521, "count": 75 }, { "lng": 126.621197, "lat": 45.767552, "count": 76 }, { "lng": 126.611721, "lat": 45.688611, "count": 77 }, { "lng": 126.651346, "lat": 45.882833, "count": 78 }, { "lng": 126.657492, "lat": 45.875288, "count": 79 }, { "lng": 126.620546, "lat": 45.899053, "count": 80 }, { "lng": 126.640968, "lat": 45.898035, "count": 81 }, { "lng": 126.096699, "lat": 45.74052, "count": 82 }, { "lng": 126.610422, "lat": 45.796992, "count": 83 }, { "lng": 126.676382, "lat": 40.040343, "count": 84 }, { "lng": 126.664304, "lat": 45.712656, "count": 85 }, { "lng": 126.677188, "lat": 45.772973, "count": 86 }, { "lng": 126.600057, "lat": 45.883241, "count": 87 }, { "lng": 126.687055, "lat": 45.865057, "count": 88 }, { "lng": 126.67842, "lat": 45.775087, "count": 89 }, { "lng": 126.681061, "lat": 45.773994, "count": 90 }, { "lng": 126.628439, "lat": 45.743564, "count": 91 }, { "lng": 126.607173, "lat": 45.815616, "count": 92 }, { "lng": 126.605081, "lat": 45.759449, "count": 93 }, { "lng": 126.60121, "lat": 45.869219, "count": 94 }, { "lng": 126.637595, "lat": 45.878214, "count": 95 }, { "lng": 126.648647, "lat": 45.781149, "count": 96 }, { "lng": 126.639298, "lat": 40.218372, "count": 97 }, { "lng": 126.602223, "lat": 45.760511, "count": 98 }, { "lng": 126.664158, "lat": 40.120092, "count": 99 }, { "lng": 126.619102, "lat": 40.233172, "count": 99 }, { "lng": 126.666931, "lat": 45.717685, "count": 100 }, { "lng": 115.977448, "lat": 40.456067, "count": 101 }, { "lng": 126.655541, "lat": 45.711069, "count": 1 }, { "lng": 126.674525, "lat": 45.744593, "count": 2 }, { "lng": 126.65277, "lat": 45.710566, "count": 3 }, { "lng": 126.610743, "lat": 45.715123, "count": 4 }, { "lng": 126.684415, "lat": 45.748468, "count": 5 }, { "lng": 126.670283, "lat": 45.72274, "count": 6 }, { "lng": 126.645304, "lat": 45.632635, "count": 7 }, { "lng": 126.658194, "lat": 45.898647, "count": 8 }, { "lng": 126.611002, "lat": 45.717643, "count": 9 }, { "lng": 126.687084, "lat": 45.759407, "count": 10 }, { "lng": 126.699161, "lat": 45.772319, "count": 11 }, { "lng": 126.61415, "lat": 40.048341, "count": 12 }, { "lng": 126.683811, "lat": 45.862684, "count": 13 }, { "lng": 126.654671, "lat": 45.793723, "count": 14 }, { "lng": 126.638059, "lat": 40.034402, "count": 15 }, { "lng": 126.664921, "lat": 40.336754, "count": 16 }, { "lng": 126.696465, "lat": 45.728236, "count": 17 }, { "lng": 126.645465, "lat": 45.815134, "count": 18 }, { "lng": 117.105997, "lat": 40.140457, "count": 19 }, { "lng": 126.658762, "lat": 40.011334, "count": 20 }, { "lng": 126.630312, "lat": 45.892811, "count": 21 }, { "lng": 126.646434, "lat": 45.781835, "count": 22 }, { "lng": 126.682718, "lat": 45.767001, "count": 23 }, { "lng": 126.631887, "lat": 45.71018, "count": 24 }, { "lng": 126.603479, "lat": 40.030135, "count": 25 }, { "lng": 126.667226, "lat": 45.897282, "count": 26 }, { "lng": 126.643197, "lat": 45.810833, "count": 27 }, { "lng": 126.671062, "lat": 40.205664, "count": 28 }, { "lng": 126.630094, "lat": 45.775569, "count": 29 }, { "lng": 126.620701, "lat": 40.030695, "count": 30 }, { "lng": 126.618237, "lat": 45.745583, "count": 31 }, { "lng": 126.684177, "lat": 45.776624, "count": 32 }, { "lng": 126.609751, "lat": 45.67949, "count": 33 }, { "lng": 126.670793, "lat": 45.776487, "count": 34 }, { "lng": 126.651952, "lat": 45.794476, "count": 35 }, { "lng": 126.698355, "lat": 40.465999, "count": 36 }, { "lng": 126.624261, "lat": 45.77006, "count": 37 }, { "lng": 126.645849, "lat": 45.702789, "count": 38 }, { "lng": 126.692448, "lat": 45.749775, "count": 45 }, { "lng": 126.604969, "lat": 45.869671, "count": 40 }, { "lng": 126.691978, "lat": 45.751331, "count": 41 }, { "lng": 126.693389, "lat": 45.763228, "count": 42 }, { "lng": 126.654359, "lat": 45.871352, "count": 43 }, { "lng": 126.650473, "lat": 45.705799, "count": 44 }, { "lng": 126.629661, "lat": 45.712838, "count": 45 }, { "lng": 126.600244, "lat": 45.753832, "count": 46 }, { "lng": 126.63445, "lat": 45.790326, "count": 47 }, { "lng": 126.627622, "lat": 45.795556, "count": 48 }, { "lng": 126.694292, "lat": 45.748671, "count": 49 }, { "lng": 126.641248, "lat": 40.382222, "count": 50 }, { "lng": 126.69621, "lat": 45.712717, "count": 51 }, { "lng": 126.69526, "lat": 45.839011, "count": 52 }, { "lng": 126.690165, "lat": 45.749776, "count": 53 }, { "lng": 126.621784, "lat": 45.83616, "count": 54 }, { "lng": 126.693875, "lat": 45.796715, "count": 55 }, { "lng": 126.624049, "lat": 45.751418, "count": 56 }, { "lng": 126.634731, "lat": 45.70149, "count": 57 }, { "lng": 126.656244, "lat": 45.710916, "count": 58 }, { "lng": 126.657003, "lat": 40.008583, "count": 59 }, { "lng": 126.6954, "lat": 45.722626, "count": 60 }, { "lng": 126.651481, "lat": 45.81428, "count": 61 }, { "lng": 126.63145, "lat": 45.891865, "count": 62 }, { "lng": 126.6393, "lat": 40.236043, "count": 63 }, { "lng": 126.624888, "lat": 45.776048, "count": 64 }, { "lng": 126.636565, "lat": 45.751957, "count": 65 }, { "lng": 126.625132, "lat": 45.872326, "count": 66 }, { "lng": 126.664558, "lat": 45.886867, "count": 67 }, { "lng": 126.62651, "lat": 45.735538, "count": 68 }, { "lng": 117.008136, "lat": 40.376266, "count": 69 }, { "lng": 126.620949, "lat": 45.87321, "count": 70 }, { "lng": 115.994695, "lat": 45.701187, "count": 71 }, { "lng": 126.600738, "lat": 45.708585, "count": 72 }, { "lng": 126.624696, "lat": 45.762873, "count": 73 }, { "lng": 126.6266, "lat": 40.08181, "count": 74 }, { "lng": 126.631061, "lat": 45.892843, "count": 75 }, { "lng": 126.69248, "lat": 45.788895, "count": 76 }, { "lng": 126.666217, "lat": 45.72232, "count": 77 }, { "lng": 126.624551, "lat": 45.740216, "count": 78 }, { "lng": 126.689698, "lat": 45.815009, "count": 79 }, { "lng": 126.666762, "lat": 40.240256, "count": 80 }, { "lng": 126.631123, "lat": 45.890995, "count": 81 }, { "lng": 126.616662, "lat": 45.869136, "count": 82 }, { "lng": 126.617434, "lat": 45.833862, "count": 83 }, { "lng": 126.689063, "lat": 45.750495, "count": 84 }, { "lng": 126.625088, "lat": 45.834288, "count": 85 }, { "lng": 126.688801, "lat": 45.765264, "count": 86 }, { "lng": 126.69665, "lat": 45.805464, "count": 87 }, { "lng": 126.654403, "lat": 45.792215, "count": 88 }, { "lng": 126.620248, "lat": 45.745852, "count": 89 }, { "lng": 115.957457, "lat": 45.599769, "count": 90 }, { "lng": 126.653289, "lat": 45.715624, "count": 91 }, { "lng": 126.638992, "lat": 45.876785, "count": 92 }, { "lng": 126.60987, "lat": 45.73606, "count": 1 }, { "lng": 126.62478, "lat": 45.7665, "count": 2 }, { "lng": 126.695136, "lat": 45.727262, "count": 3 }, { "lng": 126.679446, "lat": 45.846365, "count": 4 }, { "lng": 126.607268, "lat": 45.859229, "count": 5 }, { "lng": 126.646201, "lat": 45.743989, "count": 6 }, { "lng": 126.621964, "lat": 45.767435, "count": 7 }, { "lng": 126.643317, "lat": 45.877525, "count": 8 }, { "lng": 126.602726, "lat": 45.762996, "count": 9 }, { "lng": 126.633757, "lat": 45.716293, "count": 10 }, { "lng": 126.697368, "lat": 45.736267, "count": 11 }, { "lng": 126.681225, "lat": 45.747723, "count": 12 }, { "lng": 126.651846, "lat": 40.119239, "count": 13 }, { "lng": 126.699739, "lat": 45.760987, "count": 14 }, { "lng": 126.616824, "lat": 45.862571, "count": 15 }],
                    max: 100
                });
            });
        },
        isSupportCanvas() {
            let elem = document.createElement('canvas');
            return !!(elem.getContext && elem.getContext('2d'));
        },
        // 添加多边形
        addPolygon(data) {
            this.polygonMarker = data.map((item, i) => {
                let mark = new AMap.Polygon({
                    path: item.path,
                    strokeColor: item.num > 100 ? "#f00" : "#fed151",
                    strokeOpacity: 1,
                    strokeWeight: 2,
                    fillColor: item.num > 100 ? "#f00" : '#fed151',
                    fillOpacity: 0.2,
                    strokeStyle: 'solid',
                });
                return mark;
            })
            this.drewOverlayGroup.addOverlay(this.polygonMarker);
        },
    }
}
</script>
<style lang="scss" scoped>
.page {
    width: 100%;
    height: 100%;
    position: relative;
}

#mapContent {
    width: 100%;
    height: 100%;
}
</style>
